﻿<h1>
@ViewBag.IntRef
</h1>

@if (ViewBag.ImmediateReview == false && ViewBag.releaseOnly==false)
{
    using (Html.BeginForm("RefreshFetchLeadBlock", "Outsourcer"))
    {
        @Html.ValidationSummary(true)
        <fieldset>
        <input type="hidden" name="LeadClient" value="@(ViewBag.LeadID)" />
        <table>
        <tr>
        <th>Ref</th>
        <th>Surname</th>
        <th>Telephone</th>
        <th>Postcode</th>
        <th>By Days</th>
        <th>&nbsp;</th>
        </tr>
        <tr>
        <td><input type="text" name="leadref" id="filterLeadref" value="@(ViewBag.leadref)"/></td>
        <td><input type="text" name="surname" id="filterSurname" value="@(ViewBag.surname)"/></td>
        <td><input type="text" name="telephone" id="filterTelephone"  value="@(ViewBag.telephone)"/></td>
        <td><input type="text" name="postcode" id="filterPostcode"  value="@(ViewBag.postcode)"/></td>
        <td>
        <label>1</label><input type="radio" name="dayfilter" value="1" @(ViewBag.dayFilter == "1" ? "checked" : " ")/>
        <label>7</label><input type="radio" name="dayfilter" value="7" @(ViewBag.dayFilter == "7" ? "checked" : " ")/>
        <label>All</label><input type="radio" name="dayfilter" value="all" @(ViewBag.dayFilter == "all" ? "checked" : " ")/>
        <select name="leadFilter">
        <option value="Active" @(ViewBag.leadfilter == "Active" ? "selected" : " ")>Active</option>
        <option value="Dead" @(ViewBag.leadfilter == "Dead" ? "selected" : " ")>Dead</option>
        <option value="All" @(ViewBag.leadfilter == "All" ? "selected" : " ")>All</option>
        </select>
        </td>
        <td><input type="submit" value="Search" id="btnFilter" /></td>
        </tr>
        </table>
    </fieldset>
    }
}

<div id="showleads"></div>
	
<script type="text/javascript">
    $(document).ready(function () {

    @if(ViewBag.ImmediateReview == true || ViewBag.FiltersSelected==true || ViewBag.releaseOnly==true)
    {
    <text>
    $("#showleads").html('<div style="text-align: center;"><div><img src="@Url.Content("~/Images/ajaxspinner_large.gif")" alt="Loading..." style="margin: 20px;" /></div><div>Large quantities of leads may take a little while to appear.</div></div>');
    var link='?id=@(ViewBag.LeadID)&immediateReview=@(ViewBag.ImmediateReview)&callCentreID=@(ViewBag.CallCentreID)&surname=@(ViewBag.surname)&telephone=@(ViewBag.telephone)&postcode=@(ViewBag.postcode)&dayfilter=@(ViewBag.dayFilter)&releaseOnly=@(ViewBag.releaseOnly)&leadref=@(ViewBag.leadref)&leadFilter=@(ViewBag.leadfilter)';
    $("#showleads").load('@(Url.Action("ShowLeadsByDate", "Outsourcer"))' + link);
    </text>
    }
    

    });
</script>